#include <Array.au3>
dim $temp[4] = ["dukse","dumke","duske","skude"]
$temp2 = StringSplit("usdekm","",0)
_ArraySort($temp2)
$temp2 = _ArrayToString($temp2,"",1)
For $i = 0 To 3 Step 1
	Canonize($temp[$i])
Next

For $i = 0 To 3 Step 1
	If ($temp[$i] = Remove($temp2,$temp[$i])) Then
		MsgBox(64,"hfdsiu",$temp[$i])
	Else
		MsgBox(64,"bbbbbb",$temp[$i])
		MsgBox(64,"aaaaaa",Remove($temp2,$temp[$i]))
	EndIf
Next

Func Canonize(ByRef $x)
	$x = StringSplit($x,"",0)
	_ArraySort($x)
	$x = _ArrayToString($x,"",1)
EndFunc

Func Remove($x, $y)
	local $temp, $temp2
	$temp = StringSplit($y,"",0)
	$temp2 = StringSplit($x,"",0)
	For $i = 1 To 6 Step 1
		If (_ArraySearch($temp,$temp2[$i]) = -1) Then
			$temp2[$i] = ""
		EndIf
	Next
	Return _ArrayToString($temp2,"",1)
EndFunc